package org.springframework.xml.xpath.proxy.conversion.base;

/**
 * Converts a nodes
 *
 * @author Ray Krueger
 */
public class EnumConverter<T extends Enum<T>> extends AbstractInputStringConverter<T> {

    private final Class<T> enumClass;

    public EnumConverter(Class<T> enumClass) {
        this.enumClass = enumClass;
    }

    protected T convertString(String input) {
        return Enum.valueOf(enumClass, input);
    }

    protected Class<? extends Enum> getSupportedType() {
        return enumClass;
    }
}
